#include "Reactor.hpp"
#include "Listener.hpp"

using namespace ListenerModule;
int main(int argc,char* argv[])
{
    if (argc != 2)
    {
        std::cout << "useage: Please use ./reactor + port!!!";
        return 1;
    }
    uint16_t port = std::stoi(argv[1]);
    Reactor* reactor = new Reactor();

    //先把listener注册进去
    connction_ptr con = std::make_shared<Listener>(port);
    con->SetEvent(EPOLLIN | EPOLLET);
    
    reactor->InsertConnection(con);
    reactor->Loop();
    return 0;
}